<!DOCTYPE html>
<html>
	<head>
		<#include "/templates/commons/head.html">
		<script type="text/javascript">
			/**
			*点击添加按钮进入添加页面
			*/
			function add(){
				document.opForm.action = "${ctx!}/RoleController/add.do";
				document.opForm.submit();
			}
			/**
			*点击添加按钮进入编辑页面
			*/
			function edit(roleId){
				document.opForm.action = "${ctx!}/RoleController/getMenuByRole.do?param_roleId=" + roleId;
				document.opForm.submit();
			}
			/**
			* 删除操作
			*/
			function del(){
			    if(seleBox("ids")){
				    layer.confirm("您是否确定要删除？", {
					    	btn: ['确定', '取消']
						}, function() {
						    document.opForm.action = "${ctx!}/RoleController/deleteRele.do";
							document.opForm.submit();
						}, function() {
					});
				}
			}	
		</script>
	</head>
	<body>
		<div id="div-body" class="body">
			<form id="opForm" name="opForm" method="post">
				<!-- 顶部搜索&按钮栏 Start -->
				<blockquote class="layui-elem-quote">
					<!-- 按钮 Start -->
					<div class="layui-btn-group">
						<#if Session.CUR_MENU.addRole == 1>
							<button class="layui-btn" type="button" onclick="add();"><i class="layui-icon">&#xe654;</i>新增</button>
						</#if>
						<#if Session.CUR_MENU.deleteRole == 1>
							<button class="layui-btn" type="button" onclick="del();"><i class="layui-icon">&#xe640;</i>删除</button>
						</#if>
					</div>
					<!-- 按钮 End -->
		        </blockquote>
		        <!-- 顶部搜索&按钮栏 End -->
		        <!-- table list group Start -->
				<div class="container">
					<!-- message Start -->
		        	<div id="div-message">${message!}</div>
		        	<!-- message End -->
		        	<!-- table list Start -->
					<div class="data-grid-group">
						<table lay-filter="data-grid" class="layui-table dymanic-table">
							<thead>
								<tr>
									<th lay-data="{field:'ids', align: 'center', checkbox: true, width: '6%'}"></th>
									<th lay-data="{field:'index', align: 'center', width: '8%'}">序号</th>
									<th lay-data="{field:'roleId', align: 'center', sort:true, width: '15%'}">角色号</th>
									<th lay-data="{field:'orgName', align: 'left', sort:true, width: '28%'}">机构名称</th>
									<th lay-data="{field:'orgLevel', align: 'center', sort:true, width: '15%'}">机构级别</th>
									<th lay-data="{field:'roleName', align: 'left', sort:true, width: '28%'}">角色名称</th>
								</tr>
							</thead>
							<tbody>
								<#if resultList?exists>
									<#list resultList as RoleBean>
										<tr>
											<td>
												<input name="ids" lay-skin="primary" type="checkbox" value="${RoleBean.roleId}"/>
											</td>
											<td>${RoleBean_index + 1}</td>
											<td>${RoleBean.roleId!'-'}</td>
											<td>${RoleBean.orgName!'-'}</td>
											<td>${RoleBean.orgLevel!'-'}</td>
											<td>
												<a href="javascript:void(0);" onclick="edit('${RoleBean.roleId}')">
													${RoleBean.roleName!'-'}
												</a>
											</td>
										</tr>
									</#list>
								</#if>
							</tbody>
						</table>
					</div>
					<!-- table list End -->
				</div>
			</form>
			<!-- table list group End -->
		</div>
	</body>
</html>